<style type='text/css'>
.disabled .el-upload--picture-card {
  display: none;
}
</style>

<template>
  <div class="app-container">
    <!--搜索条件-->
    <div class="filter-container">
      <el-row :gutter="20">
        <el-col :span="4">
          <el-input v-model="listQuery.keyword" placeholder="分销商/供货商" class="filter-item" />
        </el-col>

        <el-col :span="4">
          <el-select
            v-model="listQuery.proceedCompany"
            placeholder="收款公司"
            style="width: 250px;"
            filterable
            clearable
          >
            <el-option
              v-for="proceedCompany in proceedCompanyList"
              :label="proceedCompany.text"
              :value="proceedCompany.value"
              :key="proceedCompany.value"
            />
          </el-select>
        </el-col>
        <!-- <el-col :span="4" :offset="1">
          <el-select
            v-model="listQuery.supplierName"
            placeholder="合作商"
            style="width: 250px;"
            filterable
            clearable
          >
            <el-option
              v-for="supplierName in supplierNameList"
              :label="supplierName.text"
              :value="supplierName.value"
              :key="supplierName.value"
            />
          </el-select>
        </el-col>-->

        <el-col :span="6" style="word-break: break-allword-wrap: break-wordoverflow:auto">
          <el-date-picker
            v-model="listQuery.time"
            :picker-options="pickerOptions"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            align="right"
          />
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="3">
          <span style="line-height: 40px">收款总金额:{{ totalAmount }}</span>
        </el-col>
        <el-col :span="2">
          <el-button
            class="filter-item"
            type="primary"
            icon="el-icon-search"
            @click="searchFrom"
          >{{ $t('table.search') }}</el-button>
        </el-col>
        <el-col :span="2">
          <el-button
            class="filter-item"
            type="primary"
            icon="el-icon-search"
            @click="exportProceed"
          >导出</el-button>
        </el-col>
        <el-col :span="2">
          <!--弹出添加框start-->
          <el-button
            v-if="role"
            class="filter-item"
            type="primary"
            icon="el-icon-edit"
            @click="porpAdd"
          >{{ $t('table.add') }}</el-button>
          <el-dialog
            :visible.sync="dialogFormVisible"
            :close-on-click-modal="false"
            title="添加收款记录"
            width="550px"
          >
            <el-form ref="form" :model="form" :rules="rules" label-width="80px">
              <el-form-item label="收款公司" prop="proceedCompany">
                <el-select v-model="form.proceedCompany" placeholder="请选收款公司" style="width: 250px">
                  <el-option
                    v-for="proceedCompany in proceedCompanyList"
                    :label="proceedCompany.text"
                    :value="proceedCompany.value"
                    :key="proceedCompany.value"
                  />
                </el-select>
              </el-form-item>

              <el-form-item label="合作商" prop="supplierName">
                <el-select v-model="form.supplierName" placeholder="请选择合作商" style="width: 250px">
                  <el-option
                    v-for="supplierName in supplierNameList"
                    :label="supplierName.text"
                    :value="supplierName.value"
                    :key="supplierName.value"
                  />
                </el-select>
              </el-form-item>

              <el-form-item label="供货商" prop="partnerId">
                <el-select
                  v-model="form.partnerId"
                  placeholder="请选择供货商"
                  filterable
                  style="width: 250px"
                >
                  <el-option
                    v-for="partnerlist in partnerList"
                    :label="partnerlist.text"
                    :value="partnerlist.value"
                    :key="partnerlist.value"
                  />
                  <!-- <el-option label="美博" value="美博"/>
                  <el-option label="安徽乐京电器有限公司" value="安徽乐京电器有限公司"/>-->
                </el-select>
              </el-form-item>

              <el-form-item label="分销商" prop="disId">
                <el-select
                  v-model="form.disId"
                  placeholder="请选择分销商"
                  filterable
                  style="width: 250px"
                >
                  <el-option
                    v-for="dis in disList"
                    :label="dis.disName"
                    :value="dis.disId"
                    :key="dis.disId"
                  />
                </el-select>
              </el-form-item>

              <el-form-item label="收款金额" prop="paymentAmount">
                <el-input v-model="form.paymentAmount" style="width: 250px" />
              </el-form-item>
              <el-form-item label="收款时间" prop="paymentTime">
                <el-date-picker
                  v-model="form.paymentTime"
                  type="date"
                  placeholder="选择日期"
                  style="width:250px"
                />
              </el-form-item>

              <el-form-item label="收款图片" prop="invoiceImg">
                <el-upload
                  :class="{disabled:showImage}"
                  v-model="form.invoiceImg"
                  :auto-upload="false"
                  :on-change="handleChange"
                  :on-remove="handleRemove"
                  :limit="1"
                  :on-preview="handlePictureCardPreview"
                  action="string"
                  list-type="picture-card"
                >
                  <i class="el-icon-plus" />
                </el-upload>
                <el-dialog :visible.sync="dialogVisible">
                  <img :src="dialogImageUrl" width="100%" alt >
                </el-dialog>
              </el-form-item>

              <el-form-item label="收款备注">
                <el-input v-model="form.paymentRemark" type="textarea" />
              </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
              <el-button @click="dialogFormVisible = false">取 消</el-button>
              <el-button type="primary" @click="addProceedsfunc">确 定</el-button>
            </div>
          </el-dialog>
          <!--弹出添加框end-->
        </el-col>
      </el-row>
    </div>

    <!--表格-->
    <el-table
      v-loading="listLoading"
      :data="talelist"
      border
      fit
      highlight-current-row
      style="width: 100%"
    >
      <el-table-column fixed prop="proceedCompany" label="收款公司" width="120" align="center">
        <template slot-scope="scope">
          <template v-if="scope.row.edit">
            <el-select v-model="scope.row.proceedCompany" placeholder="收款公司">
              <el-option
                v-for="proceedCompany in proceedCompanyList"
                :label="proceedCompany.text"
                :value="proceedCompany.value"
                :key="proceedCompany.value"
              />
            </el-select>
          </template>
          <span v-else>{{ scope.row.proceedCompany }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="supplierName" label="合作商" width="120" align="center">
        <template slot-scope="scope">
          <template v-if="scope.row.edit">
            <el-select v-model="scope.row.supplierName" placeholder="合作商">
              <el-option
                v-for="supplierName in supplierNameList"
                :label="supplierName.text"
                :value="supplierName.value"
                :key="supplierName.value"
              />
            </el-select>
          </template>
          <span v-else>{{ scope.row.supplierName }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="partnerName" label="供货商" width="120" align="center" />
      <el-table-column fixed prop="disName" label="分销商" width="120" align="center">
        <template slot-scope="scope">
          <template v-if="scope.row.edit">
            <el-select v-model="scope.row.disName" placeholder="分销商">
              <el-option
                v-for="dis in disList"
                :label="dis.disName"
                :value="dis.disName"
                :key="dis.disId"
              />
            </el-select>
          </template>
          <span v-else>{{ scope.row.disName }}</span>
        </template>
      </el-table-column>
      <el-table-column fixed prop="disNumber" label="分销商编号" width="120" align="center" />

      <el-table-column
        prop="paymentAmount"
        label="收款金额"
        width="120"
        align="right"
        header-align="center"
      >
        <template slot-scope="scope">
          <template v-if="scope.row.edit">
            <el-input v-model="scope.row.paymentAmount" class="edit-input" size="small" />
          </template>
          <span v-else>{{ formatterRmb(scope.row.paymentAmount) }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column prop="isHasInvoice"  label="是否开票" width="100">
        <template slot-scope="scope">
            <span>{{ scope.row.isHasInvoice | statusFilter }}</span>
          </template>
      </el-table-column>-->
      <el-table-column prop="paymentRemark" label="收款备注" width="150" align="center" />
      <el-table-column prop="paymentTime" label="收款时间" width="150" align="center">
        <template slot-scope="scope">
          <span>{{ scope.row.paymentTime | parseTime('{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>

      <el-table-column prop="invoiceImg" label="收款图片" width="150" align="center">
        <template slot-scope="scope">
          <el-popover
            v-if="scope.row.invoiceImg !== null"
            placement="right"
            width="500"
            trigger="click"
          >
            <div>
              <img :src="scope.row.invoiceImg" style="height: 400px" >
            </div>
            <img slot="reference" :src="scope.row.invoiceImg" style="height: 50px" >
          </el-popover>
          <span v-else>无</span>
        </template>
      </el-table-column>

      <el-table-column v-if="role" prop="proceedsRecordId" label="操作" width="500" align="center">
        <template slot-scope="scope">
          <el-row>
            <el-popover placement="right" width="700" trigger="click">
              <el-table :data="goodlist">
                <el-table-column width="120" property="goodsName" label="物品名称" />
                <el-table-column width="120" property="category" label="品类" />
                <el-table-column width="120" property="specification" label="规格" />
                <el-table-column width="120" property="goodsNumber" label="数量" />
                <el-table-column width="120" property="goodsPrice" label="单价" />
              </el-table>
              <el-button
                slot="reference"
                type="success"
                icon="el-icon-search"
                size="mini"
                @click="selectGoods(scope.row.proceedsRecordId)"
              >查看明细</el-button>
            </el-popover>
            <el-upload
              :show-file-list="false"
              :http-request="excelUpload"
              action="string"
              class="upload-demo"
              style="display: inline-block"
            >
              <el-button
                type="primary"
                size="mini"
                @click="changeId(scope.row.proceedsRecordId)"
              >导入明细</el-button>
            </el-upload>
            <template v-if="scope.row.edit">
              <el-button
                class="cancel-btn"
                size="mini"
                icon="el-icon-refresh"
                type="warning"
                @click="cancelEdit(scope.row)"
              >取消</el-button>
              <el-button
                type="success"
                size="mini"
                icon="el-icon-circle-check-outline"
                @click="updatePaymentRecord(scope.row, 'update')"
              >提交</el-button>
            </template>
            <template v-else>
              <el-button
                type="success"
                size="mini"
                icon="el-icon-edit"
                @click="scope.row.edit=!scope.row.edit"
              >{{ $t('table.edit') }}</el-button>
              <el-button
                type="danger"
                size="mini"
                icon="el-icon-delete"
                @click="updatePaymentRecord(scope.row, 'delete')"
              >{{ $t('table.delete') }}</el-button>
            </template>
            <template>
              <el-popover v-model="scope.row.showsms" placement="right" width="500" trigger="click">
                <el-form ref="sendform" :model="sendform" label-width="100px">
                  <el-form-item label="提醒供货商">
                    <el-input v-model="sendform.partnerName" style="width: 250px" />
                  </el-form-item>
                  <el-form-item label="收款金额">
                    <el-input v-model="sendform.paymentAmount" style="width: 250px" />
                  </el-form-item>
                  <el-form-item label="提醒手机号">
                    <el-input v-model="sendform.phone" style="width: 250px" />
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" @click="sendSms(scope.row)">确认发送</el-button>
                  </el-form-item>
                </el-form>
                <el-button
                  slot="reference"
                  icon="el-icon-message"
                  type="warning"
                  size="mini"
                  @click="popSms(scope.row)"
                >短信提醒</el-button>
              </el-popover>
            </template>
          </el-row>
        </template>
      </el-table-column>
    </el-table>

    <!--分页-->
    <div class="pagination-container">
      <el-pagination
        v-show="total>0"
        :current-page="listQuery.page"
        :page-sizes="[10, 20, 30, 50]"
        :page-size="listQuery.pageSize"
        :total="total"
        background
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </div>
  </div>
</template>

<script>
import {
  fetchList,
  distributorList,
  addProceeds,
  getGoodsList,
  addProcurementDetails,
  updateProceed,
  sendSms,
  doExportProceed,
  getProceedsSum
} from '@/api/payment'
import { getPartnerInfo } from '@/api/shipment'
import { parseTime, pickerOptions } from '@/utils'
import { getUserInfo } from '@/api/login'
// import axios from 'axios'
export default {
  filters: {
    statusFilter(status) {
      const statusMap = {
        Y: '已开票',
        N: '未开票'
      }
      return statusMap[status]
    }
  },
  data() {
    var validateNumber = (rule, value, callback) => {
      if (!Number(value)) {
        callback(new Error('请输入数字值'))
      } else {
        const regu = /^[0-9]+(\.[0-9]{1,2})?$/
        const rsCheck = regu.test(value)
        if (!rsCheck) {
          callback(new Error('请输入正确的金额类型'))
        }
        callback()
      }
    }
    return {
      totalAmount: 0,
      role: false,
      showImage: false,
      dialogImageUrl: '',
      dialogVisible: false,
      partnerList: [],
      proceedCompanyList: [
        {
          text: '深圳唯修汇科技有限公司',
          value: '深圳唯修汇科技有限公司'
        },
        {
          text: '浙江扳手科技有限公司',
          value: '浙江扳手科技有限公司'
        }
      ],
      supplierNameList: [
        {
          text: '美博',
          value: '美博'
        },
        {
          text: '星城',
          value: '星城'
        },
        {
          text: '北京盛世',
          value: '北京盛世'
        }
      ],
      proceedsRecordId: null,
      goodlist: null,
      disList: null,
      dialogFormVisible: false,
      talelist: null,
      total: 1,
      listLoading: true,
      listQuery: {
        page: 1,
        pageSize: 10,
        keyword: null,
        starTime: null,
        endTime: null,
        time: null,
        proceedCompany: null,
        supplierName: null,
        pageNumber: 0
      },
      pickerOptions: { shortcuts: pickerOptions },
      form: {
        disId: null,
        partnerName: null,
        paymentTime: null,
        paymentAmount: null,
        paymentRemark: null,
        proceedCompany: null,
        supplierName: null,
        invoiceImg: null
      },
      rules: {
        disId: [{ required: true, message: '请选择分销商', trigger: 'change' }],
        proceedCompany: [
          { required: true, message: '请选择收款公司', trigger: 'change' }
        ],
        supplierName: [
          { required: true, message: '请选择合作商', trigger: 'change' }
        ],
        partnerId: [
          { required: true, message: '请选择供货商', trigger: 'change' }
        ],
        partnerName: [
          { required: true, message: '请选择供货商', trigger: 'change' }
        ],
        paymentAmount: [
          {
            required: true,
            message: '请填写收款金额',
            validator: validateNumber,
            trigger: 'blur'
          }
        ],
        paymentTime: [
          {
            type: 'date',
            required: true,
            message: '选择收款款时间',
            trigger: 'change'
          }
        ]
      },
      sendform: {
        partnerName: null,
        paymentAmount: null,
        phone: null,
        businsseId: null
      }
    }
  },
  computed: {
    /*  role() {
      var flag = false
      getUserInfo().then(response=>{
        debugger
      if (response.data.code='success') {
            if (response.data.data.roles.indexOf('admin')>=0) {
              flag = true
            }else if (response.data.data.roles.indexOf('finance')>=0) {
                flag = true
            }else{
            flag = false
            }
        }else{
          flag = false
        }
          return flag
      })
    }*/
  },
  created() {
    this.getRole()
    this.getList()
    this.getDistributorList()
    this.getPartnerInfo()
  },
  methods: {
    exportProceed: function() {
      doExportProceed(this.listQuery).then(response => {
        const date = new Date()
        const filefix =
          date.getFullYear() +
          '-' +
          date.getMonth() +
          '-' +
          date.getDate() +
          ' ' +
          date.getHours() +
          ':' +
          date.getMinutes() +
          ':' +
          date.getSeconds()
        debugger
        const blob = new Blob([response.data], {
          type: 'text/csvchartset=utf-8' // 将会被放入到blob中的数组内容的MIME类型
        }) // 创建一个blob对象
        const a = document.createElement('a') // 创建一个<a></a>标签
        a.href = URL.createObjectURL(blob) // response is a blob
        a.download = filefix + '付款.csv' // 文件名称
        a.style.display = 'none'
        document.body.appendChild(a)
        a.click()
        a.remove()
        return response
      })
    },
    getRole() {
      getUserInfo().then(response => {
        if (response.data.status === 'ok') {
          if (response.data.data.roles.indexOf('admin') >= 0) {
            this.role = true
          } else if (response.data.data.roles.indexOf('finance') >= 0) {
            this.role = true
          } else {
            this.role = false
          }
        } else {
          this.role = false
        }
      })
    },
    formatterRmb(paymentAmount) {
      if (paymentAmount) {
        var num = paymentAmount
        num = parseFloat(num).toFixed(2)
        return '￥' + num // 返回的是字符串23, 245.12保留2位小数
      } else {
        return '￥0.00'
      }
    },
    popSms(row) {
      this.sendform.phone = null
      this.sendform.partnerName = row.partnerName
      this.sendform.paymentAmount = row.paymentAmount
      if (row.partnerName === '美博') {
        this.sendform.phone = '18825942859'
      }
      this.sendform.businsseId = row.proceedsRecordId
      row.showsms = true
    },
    sendSms(row) {
      var data = new FormData() // 重点在这里 如果使用 var data = {} data.inputfile=... 这样的方式不能正常上传
      data.append('type', 'proceed')
      data.append('phone', this.sendform.phone)
      data.append('partnerName', this.sendform.partnerName)
      data.append('paymentAmount', this.sendform.paymentAmount)
      data.append('businsseId', this.sendform.businsseId)
      data.append('disName', row.disName)
      sendSms(data).then(response => {
        row.showsms = false
        if (response.data.status === 'success') {
          this.$message({
            message: '发送成功',
            type: 'success'
          })
        } else {
          this.$message('操作失败！')
        }
      })
    },
    // 清楚校验
    porpAdd() {
      this.form.paymentTime = null
      this.dialogFormVisible = true
      this.$nextTick(() => {
        this.$refs['form'].clearValidate()
      })
    },
    // 更新
    updatePaymentRecord(row, type) {
      debugger
      var data = new FormData()
      var msg = ''
      if (type === 'update') {
        data.append('partnerName', row.partnerName)
        data.append('paymentAmount', row.paymentAmount)
        data.append('proceedCompany', row.proceedCompany)
        data.append('supplierName', row.supplierName)
        for (let index = 0; index < this.disList.length; index++) {
          if (this.disList[index].disName === row.disName) {
            data.append('disId', this.disList[index].disId)
          }
        }

        var regex = /^[0-9]*(\.[0-9]{1, 2})?$/
        if (!regex.test(row.paymentAmount)) {
          this.$message('金额格式不正确！')
          return false
        }

        msg = '恭喜你，更新成功！'
        this.updateOrdelete(data, row.proceedsRecordId, msg)
        row.edit = false
        // this.getList()
      } else if (type === 'delete') {
        for (let index = 0; index < this.disList.length; index++) {
          if (this.disList[index].disName === row.disName) {
            data.append('disId', this.disList[index].disId)
          }
        }
        data.append('deleteFlag', 'Y')
        this.$confirm('此操作将永久删除该条记录, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(() => {
            msg = '恭喜你，删除成功！'
            this.updateOrdelete(data, row.proceedsRecordId, msg)
            this.listQuery.page = 1
            this.getList()
          })
          .catch(() => {
            this.$message({
              type: 'info',
              message: '已取消删除'
            })
          })
      }
    },
    updateOrdelete(data, id, msg) {
      updateProceed(data, id).then(response => {
        if (response.data.status === 'success') {
          this.$message({
            message: msg,
            type: 'success'
          })
        } else {
          this.$message('操作失败！')
        }
      })
    },
    // 行内编辑
    cancelEdit(row) {
      row.paymentAmount = row.originalAmount
      row.edit = false
      this.$message({
        message: '已经取消',
        type: 'warning'
      })
    },
    // 查询要货明细
    selectGoods(val) {
      getGoodsList(val).then(response => {
        this.goodlist = response.data.data
      })
    },
    // 添加收款记录
    addProceedsfunc() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          debugger
          this.form.paymentTime = parseTime(
            this.form.paymentTime,
            '{y}-{m}-{d} {h}:{i}:{s}'
          )
          var data = new FormData() // 重点在这里 如果使用 var data = {} data.inputfile=... 这样的方式不能正常上传
          data.append('disId', this.form.disId)
          // if (this.form.partnerName === '美博') {
          //   data.append('partnerId', 'partner-73250')
          // } else if (this.form.partnerName === '安徽乐京电器有限公司') {
          //   data.append('partnerId', 'partner-185951')
          // }
          // data.append('partnerName', this.form.partnerName)
          var partnerName
          for (var j = 0; j < this.partnerList.length; j++) {
            if (this.partnerList[j].value === this.form.partnerId) {
              partnerName = this.partnerList[j].text
            }
          }
          data.append('partnerName', partnerName)
          data.append('proceedCompany', this.form.proceedCompany)
          data.append('supplierName', this.form.supplierName)
          data.append('partnerId', this.form.partnerId)
          data.append('paymentTime', this.form.paymentTime)
          data.append('paymentAmount', this.form.paymentAmount)
          if (this.form.paymentRemark !== null) {
            data.append('paymentRemark', this.form.paymentRemark)
          }
          data.append('invoiceImg', this.form.invoiceImg)
          addProceeds(data).then(response => {
            if (response.data.status === 'success') {
              this.$message({
                message: '恭喜你，添加成功！',
                type: 'success'
              })
              setTimeout(() => {
                this.dialogFormVisible = false
                this.getList()
              }, 1.5 * 1000)
            } else {
              this.$message('添加失败！')
            }
          })
        }
      })
    },
    // 查询分销商
    getDistributorList() {
      distributorList().then(response => {
        this.disList = response.data.data
      })
    },
    getSum() {
      getProceedsSum(this.listQuery).then(response => {
        this.totalAmount = response.data.data
      })
    },
    // 查询收款信息
    getList() {
      this.getSum()
      this.listLoading = true
      this.listQuery.pageNumber =
        (this.listQuery.page - 1) * this.listQuery.pageSize
      var vmthis = this
      fetchList(this.listQuery).then(response => {
        vmthis.total = response.data.data.total
        const items = response.data.data.list
        vmthis.talelist = items.map(v => {
          this.$set(v, 'showsms', false)
          this.$set(v, 'edit', false) // https:// vuejs.org/v2/guide/reactivity.html
          v.originalAmount = v.paymentAmount //  will be used when user click the cancel botton
          return v
        })
        console.info(this.talelist)
        vmthis.listLoading = false
        // Just to simulate the time of the request
        setTimeout(() => {
          this.listLoading = false
        }, 1.5 * 1000)
      })
    },
    handleSizeChange(val) {
      this.listQuery.pageSize = val
      this.getList()
    },
    handleCurrentChange(val) {
      this.listQuery.page = val
      this.getList()
    },
    // 搜索
    searchFrom() {
      if (this.listQuery.time !== null && this.listQuery.time !== '') {
        this.listQuery.starTime = parseTime(
          this.listQuery.time[0],
          '{y}-{m}-{d} {h}:{i}'
        )
        this.listQuery.endTime = parseTime(
          this.listQuery.time[1],
          '{y}-{m}-{d} {h}:{i}'
        )
      } else {
        this.listQuery.starTime = null
        this.listQuery.endTime = null
      }
      this.listQuery.page = 1
      this.getList()
    },
    changeId(val) {
      this.proceedsRecordId = val
    },
    // 导入
    excelUpload(item) {
      console.log(item.file)
      var formData = new FormData()
      formData.append('importExcel', item.file)
      formData.append('proceedsRecordId', this.proceedsRecordId)
      addProcurementDetails(formData).then(response => {
        if (response.data.status === 'success') {
          this.$message({
            message: '恭喜你，添加成功！',
            type: 'success'
          })
        } else {
          this.$message('导入失败')
        }
      })
    },
    handleChange(file, fileList) {
      this.form.invoiceImg = file.raw
      console.log(file, fileList)
      if (fileList.length > 0) {
        this.showImage = true
      }
    },
    handleRemove(file, fileList) {
      this.form.invoiceImg = null
      console.log(file, fileList)
      if (fileList.length === 0) {
        this.showImage = false
      }
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = URL.createObjectURL(file.raw)
      this.dialogVisible = true
    },
    getPartnerInfo(item) {
      // 查询合作商信息
      getPartnerInfo()
        .then(response => {
          if (response.data.status === 'ok') {
            this.partnerList = response.data.data
          } else {
            console.log('合作商加载失败！')
          }
        })
        .catch(error => {
          console.log(error)
        })
    }
  }
}
</script>
